import request from "@/utils/request";
const env = window.ENV || {
  API_USER: "",
  API_SKIN: "",
  VUE_APP_AUTH_SERVER_URL: "",
  VUE_APP_REALM: ""
};

//分页获取所有菜单
export function findAllAuth(query) {
  return request({
    url: env.API_USER + "/authorityEdit/findAllAuth",
    method: "get",
    params: query
  });
}
//添加菜单权限
export function addAuth(data) {
  return request({
    url: env.API_USER + "/authorityEdit/addAuth",
    method: "post",
    data: data
  });
}

//修改菜单权限
export function updateAuth(data) {
  return request({
    url: env.API_USER + "/authorityEdit/updateAuth",
    method: "post",
    data: data
  });
}
//删除前检查菜单是否有子菜单
export function deleteCheck(id) {
  return request({
    url: env.API_USER + `/authorityEdit/${id}/deleteCheck`,
    method: "get"
  });
}
//删除菜单权限
export function deleteAuth(id,code) {
  return request({
    url: env.API_USER + `/authorityEdit/${id}/deleteAuth/${code}`,
    method: "delete"
  });
}